package define

const (
	TagKeyRelationShip           = "relationship"
	LinkRelationShipRunOn        = "RunOn"
	LinkRelationShipCreateBy     = "CreateBy"
	LinkRelationShipInteractWith = "InteractWith"
	LinkRelationShipControlBy    = "ControlledBy"
)

type Link struct {
	HeadGuid  string `json:"head_guid" yaml:"head_guid"`
	HeadLabel string `json:"head_label" yaml:"head_label"`
	TailGuid  string `json:"tail_guid" yaml:"tail_guid"`
	TailLabel string `json:"tail_label" yaml:"tail_label"`
	Tags      []Tag  `json:"tags" yaml:"tags"`
}

func (r *Link) Clone() *Link {
	tags := make([]Tag, len(r.Tags))
	for k, v := range r.Tags {
		tags[k] = v
	}
	return &Link{
		HeadLabel: r.HeadLabel,
		HeadGuid:  r.HeadGuid,
		TailLabel: r.TailLabel,
		TailGuid:  r.TailGuid,
		Tags:      tags,
	}
}

type Node struct {
	Label string `json:"label" yaml:"label"`
	Guid  string `json:"guid" yaml:"guid"`
	Type  string `json:"type" yaml:"type"`
	Tags  []Tag  `json:"tags" yaml:"tags"`
}

func (r *Node) Clone() *Node {
	c := *r
	return &c
}
